<script>
$(document).ready(function(){
	$('#submit').click(function(){
		var amount_paid=$('#amount_paid').val();	
		if(!(/^[-]?\d+(?:\.\d+)?$/.test(amount_paid))){
			alert('实付金额输入有误');return;
		}
		$.ajax({
			type:'POST',
			dataType:"json",
			url:"<?php echo URL::site() ?>uploadpay/payupdate",
			async:false,
			data:{'purchaseorder_id':$('#orderid').val(),
				  'amount_paid':amount_paid,
				  'remark':$.trim($('#remark').val())},
			success:function(result){		
				if(result==0){alert("采购单未打印或者已取消");return;}			
				alert("修改成功");
			},		
		});
	}); 
});
</script>

<?php if(isset($purchaseorder_info)&&!empty($purchaseorder_info)) {?>
	供应商:&nbsp;<?php echo $supplier;?>&nbsp;&nbsp;
	支付方式:&nbsp;<?php echo $payway;?>
	<hr/>
	采购单号:                   
    <?php echo  $purchaseorder_info['id'] ?>
    <input type="hidden" value="<?php echo $purchaseorder_info['id'];?>" id="orderid">
    实付金额:
    <input class="input-mini" id="amount_paid" type="text" value="" style="width: 50px" onkeyup="this.value=this.value.replace(/[^\-?\d.]/,'')",onafterpaste="this.value=this.value.replace(/[^\-?\d.]/,'')">
    备注:
    <input class="input-mini" id='remark' type="text" value="" style="width: 100px">
	<button id="submit" class="btn btn-success">提交</button>
<?php }?>
